/*!
 * \file ast_dot_visitor.h
 *
 * \brief Declarations of the DotVisitor for the ast structure
 *
 * \date Started: 7/12/2010
 * \date Last Modified: 7/27/2010
 * \authors Alan LaMielle
 * \authors Ian Craig
 * \authors Nicholas Jeanette
 *
 * Copyright (c) 2010, Colorado State University <br>
 * All rights reserved. <br>
 * See ../../COPYING for details. <br>
 */


#ifndef DOTVISITOR_H
#define DOTVISITOR_H

#include <iegenlib/iegenlib.h>

#include <sstream>
using std::endl;

namespace iegenlib{

/*!
 * \class DotVisitor
 *
 * \brief Creates a string that is a formatted dot file representing the AST
 *
 */
class DotVisitor : public DepthFirstVisitorAdapter{
public:

  inline DotVisitor():count(0){};

  void defaultIn(Node* node);

  void defaultOut(Node* node);

  //used to set the counter to 0
//  void PresFormIn(PresForm* node);

  /*
   * returns the all information needed to make a dot file as a string. This can
   * then be passed in a file to actually create a dot file.
   * @return a string representation of the dot file
   */
  inline std::string getString(){return filestr.str();};

private:

  ///filestream to output to
  std::stringstream filestr;

  ///helper counter to keep track of what nodes point where
  int count;

  ///helper stack to keep track of what nodes we have visited
  stack<int> nodeStack;
};

}//end namespace iegenlib

#endif
